﻿Imports System.Drawing.Drawing2D

Class MenuRenderer
    Inherits ToolStripProfessionalRenderer

    Protected Overrides Sub OnRenderMenuItemBackground(ByVal e As System.Windows.Forms.ToolStripItemRenderEventArgs)
        e.Graphics.SmoothingMode = SmoothingMode.HighQuality
        Dim R As New Rectangle(0, 0, e.Item.Width, e.Item.Height - 1)
        R.Inflate(-2, 0)
        e.Graphics.DrawFocusRect(R, e.Item.Selected, False, False, False, True)
        e.Graphics.SmoothingMode = SmoothingMode.None
    End Sub

    Protected Overrides Sub OnRenderItemImage(ByVal e As System.Windows.Forms.ToolStripItemImageRenderEventArgs)
        If Not e.Item.Enabled Then
            e.Graphics.DrawImage(e.Image.Disabled, e.ImageRectangle)
        Else
            MyBase.OnRenderItemImage(e)
        End If
    End Sub

End Class